<?php
namespace app\common\model;

use think\Model;

class Msg extends Model
{
    public function getList(array $where=[], $pageSize=false, array $pageconfig=[], $fields=false, $order='id desc')
    {
        return $this->where($where)->field($fields)->order($order)->paginate($pageSize, false, $pageconfig);
    }
    public function insertMsg($content, $user_id=0, $title='') {
        $data = [
            'title' => trim($title),
            'content' => trim($content),
            'user_id' => intval($user_id),
            'read_user_id' => ',',
            'add_time' => time()
        ];
        return $this->insert($data);
    }
}